﻿@{
    ViewBag.Title = "添加项目";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";
}

<div class="main layui-clear">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>添加项目</legend>
    </fieldset>
    <div class="layui-form layui-form-pane">
        <form method="post">
            @Html.AntiForgeryToken()
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label for="L_title" class="layui-form-label">项目名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="Name" name="Name" required lay-verify="required" autocomplete="off" class="layui-input" />
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">项目类别</label>
                    <div class="layui-input-block">
                        <select id="ProjectKind" name="ProjectKind">
                            <option value="0">移行项目</option>
                            <option value="1">版本升级</option>
                            <option value="2">式样变更</option>
                            <option value="3">式样书作成</option>
                            <option value="4">新规作成</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label for="L_title" class="layui-form-label">项目纳期</label>
                    <div class="layui-input-block">
                        <input id="EndDate" name="EndDate" class="layui-input" required lay-verify="EndDate" autocomplete="off" />
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">部门</label>
                    <div class="layui-input-block">
                        <select id="Depart" name="Depart" required>
                            <option value="1">一部</option>
                            <option value="2">二部</option>
                            <option value="3">三部</option>
                            <option value="4">四部</option>
                            <option value="5">五部</option>
                            <option value="6">六部</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">语言区分</label>
                    <div class="layui-input-block" style="width:100px;">
                        <select id="LangKind" name="LangKind">
                            <option value="OpenLang" selected>Open系</option>
                            <option value="HostLang">Host系</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">移行前语言</label>
                    <div class="layui-input-block" style="width:150px;">
                        <select id="BefLang" name="BefLang" required></select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">移行后语言</label>
                    <div class="layui-input-block" style="width:150px;">
                        <select id="AftLang" name="AftLang"></select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">数据库区分</label>
                    <div class="layui-input-block" style="width:100px;">
                        <select id="DBKind" name="DBKind">
                            <option value="DBOSkill" selected>Open系</option>
                            <option value="DBHSkill">Host系</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">移行前语言</label>
                    <div class="layui-input-block" style="width:150px;">
                        <select id="BefDB" name="BefDB" required></select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">移行后语言</label>
                    <div class="layui-input-block" style="width:150px;">
                        <select id="AftDB" name="AftDB"></select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label for="Info" class="layui-form-label">项目描述</label>
                <div class="layui-input-block">
                    <textarea id="Info" name="Info" autocomplete="off" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>信息提交</button>
            </div>
        </form>
    </div>
</div>
@section scripts{
    <script>
        layui.use(['laydate', 'jquery','form','common'], function () {
            var $ = layui.jquery;
            var laydate = layui.laydate;
            var form = layui.form;
            var com = layui.common;
            laydate.render({
                elem: '#EndDate'
                , type: 'date'
                , trigger: 'click'
                , format: 'yyyy/MM/dd'
                , theme: '#558AC0'
                , calendar: true
            });

            form.verify({
                EndDate: function (value) {
                    if (value.length == 0) {
                        return '项目纳期不能为空！';
                    }
                    if (new Date(value) <= new Date()) {
                        return '项目纳期不能小于当前时间！';
                    }
                }
            });

           com.getOption('/Skill/SkillNames', "DBOSkill" ,"BefDB", "AftDB");
           com.getOption('/Skill/SkillNames', "OpenLang", "BefLang", "AftLang");
        })
    </script>
}